﻿@using GSLMS.WebAPP
@model GSLMS.Entity.TB_APP_SPECIALINFO
@{
    Layout = null;
    var SpecialType = ViewData["SpecialType"] as SelectList;
    var ddlCustList = ViewData["CustList"] as SelectList;
    var ddlProduct = ViewData["Product"] as SelectList;
}
<div class="pageContent">
    <form method="post" id="formSpecailInfo"  action="DianDang/Apply/SpecailInfo/Create?OpID=@ViewData["OperateID"]" class="pageForm required-validate"
    onsubmit="return validateCallback(this, dialogAjaxDone)">
    @Html.ValidationSummary(true)
    <div class="pageFormContent" layouth="56">
        @Html.HiddenFor(model => model.ID)
        <p>
            <label>
                标题：</label>
            @Html.TextBoxFor(model => model.SPECIALTITLE, new { @class = "required" })
            @Html.ValidationMessageFor(model => model.SPECIALTITLE)
        </p>
        <p>
            <label>
                类型：</label>
            @Html.DropDownListFor(model => model.SPECIALTYPE, SpecialType, new { @class = "combox" })
            @Html.ValidationMessageFor(model => model.SPECIALTYPE)
        </p>
        <p>
            <label>
                客户名称：</label>
            @Html.DropDownListFor(model => model.CUSTNAME, ddlCustList, HelperCommon.SelectDefaultValue, new { @class = "combox",@selectedvalue = Model.REGINFOID, @onchange = "GetCustomerInfo(this)" })
            
            @Html.Hidden("HIDCUSTNAME",Model.CUSTNAME)
             @Html.HiddenFor(model => model.REGINFOID)
            @Html.ValidationMessageFor(model => model.CUSTNAME)
        </p>
        <p>
            <label>
                项目经理：</label>
            @Html.TextBoxFor(model => model.SALESMAN, new { @class = "", @readonly = "true" })
            @Html.ValidationMessageFor(model => model.SALESMAN)
            @Html.HiddenFor(model => model.SALESMANID)
        </p>
        <p>
            <label>
                所属部门：</label>
            @Html.TextBoxFor(model => model.DEPNAME, new { @class = "", @readonly = "true" })
            @Html.ValidationMessageFor(model => model.DEPNAME)
            @Html.HiddenFor(model => model.DEPID)
            
        </p>
        <p>
            <label>
                贷款产品：</label>
            @Html.DropDownListFor(model => model.PRODUCTID, ddlProduct, new { @class = "combox", @selectedvalue = Model .PRODUCTID,@sumbitText="PRODUCTNAME"})
            @Html.ValidationMessageFor(model => model.PRODUCTID)
        </p>
        <div class="divider">
        </div>
        <p style="width: 90%">
            <label>
                详细内容：</label>
            @Html.TextAreaFor(model => model.DETAIL, new { @cols = "70", @rows = "5" })
            @Html.ValidationMessageFor(model => model.DETAIL)
        </p>

        @Html.HiddenFor(model => model.STATUS)
    </div>
    <div class="formBar">
        <ul>
            <li>
                <div class="buttonActive">
                    <div class="buttonContent">
                        <button type="submit" onclick="toSave(0)">
                            保存</button></div>
                </div>
            </li>
            <li>
                <div class="buttonActive">
                    <div class="buttonContent">
                        <button type="submit" onclick="toSave(1)">
                            提交</button></div>
                </div>
            </li>
        </ul>
    </div>
    </form>
</div>
<script type="text/javascript">
    function toSave(n) {
        $("#STATUS").val(n);
    }

    function GetCustomerInfo(obj) {
        $this = $(obj);
        var id = $this.val();

        if (id) {
            $("#REGINFOID").val(id);
            $.ajax({
                type: 'POST',
                url: "DianDang/Apply/SpecailInfo/GetCustomerInfo",
                data: { id: id },
                cache: false,
                success: function (response) {
                    var json = eval(response);                    
                    $("#SALESMAN").val(json.SALESMAN);
                    $("#SALESMANID").val(json.SALESMANID);
                    $("#DEPNAME").val(json.DEPNAME);
                    $("#DEPID").val(json.DEPID);
                    $("#HIDCUSTNAME").val(json.CUSTNAME);
                    
                }
            });
        }
    }
</script>
